import { defHttp } from '/@/utils/http/axios';
import { GetUserInfoModel } from './model/userModel';

enum Api {
  GetUserInfo = '/shop-admin/api/v1/admin/user/me',
  GetPermCode = '/getPermCode',
  TestRetry = '/testRetry',
}

/**
 * @description: getUserInfo
 */
export function getUserInfo() {
  return defHttp.get<GetUserInfoModel>({ url: Api.GetUserInfo }, { errorMessageMode: 'none' });
}

export function getPermCode() {
  return defHttp.get<string[]>({ url: Api.GetPermCode });
}

export function testRetry() {
  return defHttp.get(
    { url: Api.TestRetry },
    {
      retryRequest: {
        isOpenRetry: true,
        count: 5,
        waitTime: 1000,
      },
    },
  );
}
